<template>
	<view class="zone">
		<Header title="设置" color="#fff"></Header>

		<view class="main">
			<view class="box">
				<view class="item" @click="zhuxiao">
					<text>注销账户</text>
					<image src="http://img.cpgm.cc/panda/static/my/you.png" class="you" mode="widthFix"></image>
				</view>
				<view class="item" @click="$p.navto('/pages/login/privacy')">
					<text>隐私政策</text>
					<image src="http://img.cpgm.cc/panda/static/my/you.png" class="you" mode="widthFix"></image>
				</view>

				<view class="item" @click="$p.navto('/pages/login/agreement')">
					<text>用户协议</text>
					<image src="http://img.cpgm.cc/panda/static/my/you.png" class="you" mode="widthFix"></image>
				</view>
				<view class="item" @click="clearCache" v-show="clearshow" >
					<text>清除缓存</text>
					<image src="http://img.cpgm.cc/panda/static/my/you.png" class="you" mode="widthFix"></image>
				</view>
				<view class="item"  @click="logout">
					<text>退出登录</text>
					<image src="http://img.cpgm.cc/panda/static/my/you.png" class="you" mode="widthFix"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: '邀请好友',
				clearshow: false,
			};
		},
		onLoad() {
			this.isshowclear()
		},
		methods: {
			isshowclear() {
				if (window.plus) {
					this.clearshow = true
				}
			},
			// 清除缓存
			clearCache() {
				uni.showLoading({
					title: '清理中'
				});
				plus.cache.clear(res => {
					setTimeout(() => {
						uni.hideLoading();
						this.$u.toast('清理成功')
						this.clearquit()
					}, 1000);
				})
			},

			// 注销账户
			zhuxiao() {
				this.$p.navto('/pages/my/my_off_detil')
			},

			logout() {
				uni.removeStorageSync('token');
				uni.removeStorageSync('id');
				uni.reLaunch({
					url: '/pages/login/login'
				});
			},
		}
	}
</script>

<style lang="scss" scoped>

	.zone {
		background: linear-gradient(180deg, #0477FD 0%, #7AFDCF 100%);
		min-height: 100vh;
	}

	.main {
		padding: 10px;
	}

	.box {
		background: rgba(255,255,255,0.6);
		box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
		border-radius: 7px;
		padding: 10px;
	}


	.item {
		background: #FFFFFF;
		border-radius: 7px;
		padding: 20px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 10px;

		text {
			color: #131314;
			font-size: 14px;
			font-weight: 600;
		}

		image {
			width: 10px;
		}
	}


	

	.liebiao {
		height: 140rpx;
		width: 90%;
		margin: 0 auto;
		border-bottom: 2rpx solid #D7E5F0;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.left {
			font-size: 27rpx;
			font-weight: 600;
			color: #131314;
		}

		.img_right {
			width: 20rpx;
			height: 25rpx;
		}
	}
</style>